home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol F-12 / (Vol F-12) Jun 02 2012.iso / Screensaver / screensaver_installer.exe / ____swmx / scripts / frame_1 / DoAction_3.as < prev    next >
Text File  |  2004-10-21  |  6KB  |  226 lines

  1. _global.ScreenweaverEvents = function()
  2. {
  3.    ASBroadcaster.initialize(this);
  4. };
  5. ScreenweaverEvents.prototype.init = function()
  6. {
  7.    if(this.__initialized != undefined)
  8.    {
  9.       return undefined;
  10.    }
  11.    swInterface.setEventListener("WindowGeneric",this.onWindowGeneric);
  12.    swInterface.setEventListener("SystemGeneric",this.onSystemGeneric);
  13.    this.__initialized = true;
  14. };
  15. ScreenweaverEvents.prototype.onWindowGeneric = function()
  16. {
  17.    var bForward = true;
  18.    if(swEvents[arguments[0]] != undefined)
  19.    {
  20.       bForward = swEvents[arguments[0]].apply(this,arguments) != undefined;
  21.    }
  22.    if(bForward)
  23.    {
  24.       swEvents.broadcastMessage.apply(swEvents,arguments);
  25.    }
  26. };
  27. ScreenweaverEvents.prototype.onSystemGeneric = function()
  28. {
  29.    var bForward = true;
  30.    if(swEvents[arguments[0]] != undefined)
  31.    {
  32.       bForward = swEvents[arguments[0]].apply(this,arguments) != undefined;
  33.    }
  34.    if(bForward)
  35.    {
  36.       swEvents.broadcastMessage.apply(swEvents,arguments);
  37.    }
  38. };
  39. ScreenweaverEvents.prototype.onWindowActivate = function(inactiveHandle, inactiveId)
  40. {
  41.    swWindow.Data.active = true;
  42.    swApplication.Data.activeWindowId = swWindow.getWindowId();
  43.    swApplication.Data.activeWindowHandle = swWindow.getWindowHandle();
  44.    return arguments;
  45. };
  46. ScreenweaverEvents.prototype.onWindowDeactivate = function(activeHandle, activeId)
  47. {
  48.    swWindow.Data.active = false;
  49.    swApplication.Data.activeWindowId = activeId;
  50.    swApplication.Data.activeWindowHandle = activeWindowHandle;
  51.    return arguments;
  52. };
  53. ScreenweaverEvents.prototype.onGlobalMouseMove = function()
  54. {
  55.    arguments.unshift("onGlobalMouseMove");
  56.    swEvents.broadcastMessage.apply(swEvents,arguments);
  57. };
  58. ScreenweaverEvents.prototype.onWindowShow = function()
  59. {
  60.    swWindow.data.visible = true;
  61.    return arguments;
  62. };
  63. ScreenweaverEvents.prototype.onWindowHide = function()
  64. {
  65.    swWindow.data.visible = false;
  66.    return arguments;
  67. };
  68. ScreenweaverEvents.prototype.onWindowData = function()
  69. {
  70.    if(arguments[1].__sw_rmc == 1)
  71.    {
  72.       var args = arguments[1];
  73.       var pMethod = _root;
  74.       var iStart = 0;
  75.       var iStop = args.method.indexOf(".");
  76.       var bFirst = true;
  77.       while(iStop != -1 && pMethod != undefined)
  78.       {
  79.          pMethod = pMethod[args.method.substr(iStart,iStop - iStart)];
  80.          if(pMethod == undefined && bFirst)
  81.          {
  82.             pMethod = _global[args.method.substr(iStart,iStop - iStart)];
  83.          }
  84.          bFirst = false;
  85.          iStart = iStop + 1;
  86.          iStop = args.method.indexOf(".",iStart);
  87.       }
  88.       if(pMethod != undefined)
  89.       {
  90.          pMethod = pMethod[args.method.substr(iStart,args.method.length - iStart)];
  91.          if(pMethod != undefined)
  92.          {
  93.             pMethod.apply(_root,args.args);
  94.          }
  95.       }
  96.       else
  97.       {
  98.          swDebug.trace("method is undefined");
  99.       }
  100.       return undefined;
  101.    }
  102.    return arguments;
  103. };
  104. ScreenweaverEvents.prototype.onWindowMove = function(name, x, y, clientx, clienty)
  105. {
  106.    swWindow.data.x = x;
  107.    swWindow.data.y = y;
  108.    swWindow.data.clientx = clientx;
  109.    swWindow.data.clienty = clienty;
  110.    return arguments;
  111. };
  112. ScreenweaverEvents.prototype.onWindowSize = function(name, cx, cy, clientcx, clientcy)
  113. {
  114.    swWindow.data.cx = cx;
  115.    swWindow.data.cy = cy;
  116.    return arguments;
  117. };
  118. ScreenweaverEvents.prototype.onWindowExitMove = function(name, x, y)
  119. {
  120.    swWindow.data.x = x;
  121.    swWindow.data.y = y;
  122.    return arguments;
  123. };
  124. ScreenweaverEvents.prototype.onWindowExitSize = function(name, cx, cy)
  125. {
  126.    swWindow.data.cx = cx;
  127.    swWindow.data.cy = cy;
  128.    return arguments;
  129. };
  130. ScreenweaverEvents.prototype.onSysColorChange = function(name, newColors)
  131. {
  132.    swSystem.data.Colors = newColors;
  133.    arguments.pop();
  134.    return arguments;
  135. };
  136. ScreenweaverEvents.prototype.onCtrlV = function(name, data)
  137. {
  138.    if(swWindow.CtrlV)
  139.    {
  140.       field = eval(Selection.getFocus());
  141.       if(field instanceof TextField)
  142.       {
  143.          field.replaceSel(data);
  144.          field.broadcastMessage("onChanged",field);
  145.       }
  146.    }
  147.    return arguments;
  148. };
  149. ScreenweaverEvents.prototype.onCtrlC = function()
  150. {
  151.    if(swWindow.CtrlC)
  152.    {
  153.       field = eval(Selection.getFocus());
  154.       if(field instanceof TextField)
  155.       {
  156.          var iBeginIndex = Selection.getBeginIndex();
  157.          var iLength = field.text.length;
  158.          getURL("FSCommand:sw_setClipboardText",field.text.substr(iBeginIndex,iLength - (iLength - Selection.getEndIndex()) - iBeginIndex));
  159.       }
  160.    }
  161.    return arguments;
  162. };
  163. ScreenweaverEvents.prototype.onCtrlA = function()
  164. {
  165.    if(swWindow.CtrlA)
  166.    {
  167.       field = eval(Selection.getFocus());
  168.       if(field instanceof TextField)
  169.       {
  170.          Selection.setSelection(0,field.text.length);
  171.       }
  172.    }
  173.    return arguments;
  174. };
  175. ScreenweaverEvents.prototype.onCtrlX = function()
  176. {
  177.    if(swWindow.CtrlX)
  178.    {
  179.       field = eval(Selection.getFocus());
  180.       if(field instanceof TextField)
  181.       {
  182.          var iBeginIndex = Selection.getBeginIndex();
  183.          var iLength = field.text.length;
  184.          var iCaret = Selection.getCaretIndex();
  185.          getURL("FSCommand:sw_setClipboardText",field.text.substr(iBeginIndex,iLength - (iLength - Selection.getEndIndex()) - iBeginIndex));
  186.          field.text = field.text.substr(0,iBeginIndex) + field.text.slice(Selection.getEndIndex(),length);
  187.          Selection.setSelection(iCaret,iCaret);
  188.          field.broadcastMessage("onChanged",field);
  189.       }
  190.    }
  191.    return arguments;
  192. };
  193. ScreenweaverEvents.prototype.trackWindowSize = function(bValue)
  194. {
  195.    if(bValue)
  196.    {
  197.       swInterface.setEventListener("WindowSize",swEvents.onWindowSize);
  198.    }
  199.    else
  200.    {
  201.       swInterface.clearEventListener("WindowSize");
  202.    }
  203. };
  204. ScreenweaverEvents.prototype.trackWindowMove = function(bValue)
  205. {
  206.    if(bValue)
  207.    {
  208.       swInterface.setEventListener("WindowMove",swEvents.onWindowMove);
  209.    }
  210.    else
  211.    {
  212.       swInterface.clearEventListener("WindowMove");
  213.    }
  214. };
  215. ScreenweaverEvents.prototype.trackGlobalMouse = function(bValue)
  216. {
  217.    if(bValue)
  218.    {
  219.       swInterface.setEventListener("MouseMove",swEvents.onGlobalMouseMove);
  220.    }
  221.    else
  222.    {
  223.       swInterface.clearEventListener("MouseMove");
  224.    }
  225. };
  226.